<script type="text/javascript">
                $(function(){
                   $('#coupon_sn').change(function(){
                       var coupon_sn = $('#coupon_sn').val();
                       if(coupon_sn == '')
                       {
						   $('.show-message').find('span').hide();
                           return;
                       }
                       $.getJSON("mobile/index.php?app=order&act=check_coupon", {coupon_sn: coupon_sn, store_id: '<?php echo $_GET['store_id']; ?>'}, function(data){
                           if(data['retval'])
                           {
                               $('.unusable').hide();
                               var msg = '有效 该优惠券的优惠价格为';
                               var str = price_format(data['retval']['price']);
                               $('.usable').show().html(msg + str).css("display","inline-block");
                           }
                           else
                           {
                               $('.usable').hide();
                               $('.unusable').show().css("display","inline-block");
                               $('#coupon_sn').val('');
                           }
                       });
                   });
				   $('.make_sure .title').click(function(){
					   $(this).next().toggle();
					   $('.show-message').find('span').hide();
					   $("select[name='coupon_sn']")[0].selectedIndex=0;
					   $('#coupon_sn-button span').html('请选择优惠券');
					});
               });
                </script>
<div class="make_sure">
	<?php if ($this->_var['goods_info']['allow_coupon']): ?><p class="title clearfix">使用优惠券</p><?php endif; ?>
	<?php if ($this->_var['goods_info']['allow_coupon']): ?>
	<div style="display:none;" class="coupon-input hidden">
		<p class="wrap-model">
            <select id="coupon_sn"  name="coupon_sn" >
                 <option value="">请选择优惠券</option>
                 <?php $_from = $this->_var['coupon_list']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'coupon');if (count($_from)):
    foreach ($_from AS $this->_var['coupon']):
?>
                 <option value="<?php echo $this->_var['coupon']['coupon_sn']; ?>">SN:<?php echo $this->_var['coupon']['coupon_sn']; ?></option>
                 <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
            </select>
		</p>
	</div>
	<p class="show-message">
		<span style="display:none;" class="usable">有效 该优惠券的优惠价格为</span> <span style="display:none;" class="unusable">无效的优惠券.您可以到 <a href='index.php?app=my_coupon'>我的优惠券</a> 登记或者查询具体的优惠券信息</span> 
	</p>
	<?php endif; ?>
	<div class="bottom-background"></div>
</div>
<div class="go-next-step">
	<div class="clearfix">
		<p>总价: <strong id="order_amount">&yen;<?php echo $this->_var['goods_info']['amount']; ?></strong></p>
		<a href="javascript:void($('#order_form').submit());" class="btn">提交订单</a>
	</div>
</div>